UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TP0hO2Yp0wyhf5T0x8lR7O6WayG6KmOxXUq2YvKvj+E=' 
WHERE 
  key_id = '2f5ade31bbbcc8524f7e902c5882b0355b39128f8ea143950c80600168dd89c5' 
  AND (
    token = 'TP0hO2Yp0wyhf5T0x8lR7O6WayG6KmOxXUq2YvKvj+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00308