UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bhsGuhifJk8fJJwys7ld6T1u/Z05hNKZdADhij6v1cY=' 
WHERE 
  key_id = 'a309158e3dc9d4c931ca4f6d8459026765cbf631812d9f1c5d90828e17fba858' 
  AND (
    token = 'bhsGuhifJk8fJJwys7ld6T1u/Z05hNKZdADhij6v1cY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034