UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V5Zufj/s1uNlQtO01d/zCROc70qAuVH/JojVLEcizF4=' 
WHERE 
  key_id = '3ed3ab409073225c046d5336e97747a8993913b2cf3d7f7801857dcae4f065df' 
  AND (
    token = 'V5Zufj/s1uNlQtO01d/zCROc70qAuVH/JojVLEcizF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023