UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5L/iFEVbwrmo/ll9HqbmDwvkHeWs03fyZET3qQ+Yik=' 
WHERE 
  key_id = '4789f8fba122a9598995d4d617807983f6b2b9f358a6a5b9ea474e1dde7ef650' 
  AND (
    token = 'X5L/iFEVbwrmo/ll9HqbmDwvkHeWs03fyZET3qQ+Yik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031