UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5xCrR7KBdM2s5L8/518P6ks6Xex6HRbHESRlGsdks2Q=' 
WHERE 
  key_id = 'd5caa02f1d2adfc78abfbbf83bed962d268e6a4f2b661da76766c3c107a2e6ed' 
  AND (
    token = '5xCrR7KBdM2s5L8/518P6ks6Xex6HRbHESRlGsdks2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026