UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dp+Wf0GuYtaYO41dXzHV6HpmmQoS/V/EusnMEBlbO+w='
WHERE
key_id = 'e388b16cfb6c1510af3eb74a08383210380dbbc43fd25b47d6f0dd305a5f8805'
AND (
token = 'dp+Wf0GuYtaYO41dXzHV6HpmmQoS/V/EusnMEBlbO+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)