UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fTR953igHvL1VCNsqKUHrgQlAMNpiP8QRRcoAuFul8g=' 
WHERE 
  key_id = '642b0fa22c102bdc0a12a5aeb42790e320bbb296ce10003d9ad7f7bf12045157' 
  AND (
    token = 'fTR953igHvL1VCNsqKUHrgQlAMNpiP8QRRcoAuFul8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039