UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cZZwoLoXus9laeaGM1r7B1RpQ3Eb7lYSgvWifUAg2Bs=' 
WHERE 
  key_id = 'cce065018db577fc03502f413d6434c88134831493de3e29fb133cb2839f409b' 
  AND (
    token = 'cZZwoLoXus9laeaGM1r7B1RpQ3Eb7lYSgvWifUAg2Bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052