UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DsK94yWg5UwRupkM5xTR4ucIArRYKhOVmGL733yO8OU=' 
WHERE 
  key_id = '1a014b2b1fff12c47a28d820e20e9dca0182d259b6c2805ae6dc5f14b04559ad' 
  AND (
    token = 'DsK94yWg5UwRupkM5xTR4ucIArRYKhOVmGL733yO8OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028