UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Shp9Lgjh66tfaYTS4C6ZYWg8j97nszFQHvgZUBwpYE=' 
WHERE 
  key_id = '1d0777524bc4b1f5882be4daff5bd657de9fe7248d6b3a3c529c3a4c59d10b47' 
  AND (
    token = '7Shp9Lgjh66tfaYTS4C6ZYWg8j97nszFQHvgZUBwpYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038