UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7IQYnPWhCPfJEH4klEfMuLhH2mnn2PXYhgw8bydywQU='
WHERE
key_id = 'a4c4d5714904c4d68c7c89a642526d20010bf61a41bfdbae115d830eb890eb2c'
AND (
token = '7IQYnPWhCPfJEH4klEfMuLhH2mnn2PXYhgw8bydywQU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)