UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oTcLTOSFPtykei/s0vwByo0RR8E87Cdv3OmLs3FyXRk='
WHERE
key_id = 'a9efcaa79f782e07ee56a9047d80e271f9e90bc0d8f17f0df9eb5ca34b88480e'
AND (
token = 'oTcLTOSFPtykei/s0vwByo0RR8E87Cdv3OmLs3FyXRk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)