UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LwHB1DsIZn2pAgESbFGgAc7EkrzNQWSfnlx5t4R5frQ=' 
WHERE 
  key_id = 'f5867e400e4c35d4f160890a00e484cbb16a57caf251fb88275140dae1583550' 
  AND (
    token = 'LwHB1DsIZn2pAgESbFGgAc7EkrzNQWSfnlx5t4R5frQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021