UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHUA1SAp8umrbIvIvtPqhDqkTFfiABAELYjeFHTnUI8=' 
WHERE 
  key_id = '27b1d8d96160b3250dfaec29f55801ae2382244da066844471de4c2f2fb4df30' 
  AND (
    token = 'rHUA1SAp8umrbIvIvtPqhDqkTFfiABAELYjeFHTnUI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025