UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jK4L6kID7I2DsrvwWIY9hoDChy/2aJLWrSJADPk7dmE=' 
WHERE 
  key_id = '307178c628b54eb18a1e4bf000bef638792b1b990fb6683df8943c5a54638007' 
  AND (
    token = 'jK4L6kID7I2DsrvwWIY9hoDChy/2aJLWrSJADPk7dmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026