UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qWjfWxelzbWFtbAOK79+gPhXadWx0xXyDzL0ZTem2Ow='
WHERE
key_id = 'e620fee014c1da4cb45f5ad8b9a91cf5bcd819675de5442cb71da0852b1c0e8a'
AND (
token = 'qWjfWxelzbWFtbAOK79+gPhXadWx0xXyDzL0ZTem2Ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)