UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '551EAiseGAtLafp8XoNFe0bSx4k+AttpCeFYqvX8xKk='
WHERE
key_id = 'b9be30dd803f92e233750714e695cb102b0b10d6df60da3cb259078a369db47f'
AND (
token = '551EAiseGAtLafp8XoNFe0bSx4k+AttpCeFYqvX8xKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)