UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDpj1BX5maDe8UJs4dHK/aUmmfk7KhqHP0qobCMUUDc=' 
WHERE 
  key_id = '09eaacff9b40187bab1814c4253635723e0a6483b8da22651c556fce90388b1f' 
  AND (
    token = 'HDpj1BX5maDe8UJs4dHK/aUmmfk7KhqHP0qobCMUUDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037