UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm8dXxexkPZMGhQJkS20sH/uvLZzpyxCExfR2qeQTju0=' 
WHERE 
  key_id = 'c42114538578aedda103aaa6b8de2fc1a9a9a1a355a246d3c98937f4e7d0104c' 
  AND (
    token = 'm8dXxexkPZMGhQJkS20sH/uvLZzpyxCExfR2qeQTju0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038