UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iFR0/swHWkeLxWwo7kLySG+yXw7/zSrRKZNrrpVd0zA=' 
WHERE 
  key_id = '08d33c46c9275bbb5c01e60f7d990e9be48b6c7228383384745fb57773d97fec' 
  AND (
    token = 'iFR0/swHWkeLxWwo7kLySG+yXw7/zSrRKZNrrpVd0zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041