UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TMTfrlbrVfz0pRzDztoVYnESA9492qzP/NcvBXcMHx4=' 
WHERE 
  key_id = 'c83c0ef3a7fd90c2ce833cc74b2d4440191c9c2e5a3f2063cd0f574169c6b280' 
  AND (
    token = 'TMTfrlbrVfz0pRzDztoVYnESA9492qzP/NcvBXcMHx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075