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

Query time 0.00021