UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yXfW5byYaGQo2I5GR0c8LcLFBjPHydmd4CDiZ+PsPUU='
WHERE
key_id = 'a033bedc0c30b9c98c3ca76957281283097b9e455697ad324b71e3adc5a0a57a'
AND (
token = 'yXfW5byYaGQo2I5GR0c8LcLFBjPHydmd4CDiZ+PsPUU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)