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

Query time 0.00023