UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PeEvMeMunOox658E1Z0klqze1Cg1R5850P+wq2aFm5U=' 
WHERE 
  key_id = '46a6aa87e622d309086b4925748592f0d123766eb077ef260510e6126a1b06e3' 
  AND (
    token = 'PeEvMeMunOox658E1Z0klqze1Cg1R5850P+wq2aFm5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019