UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lkl4eYXvXFlVJaMOqlib3wWFf3LooXHGezczBiAubJw='
WHERE
key_id = 'bf1ea884207c4cd69b90333327f990a7f2a0ad6e948067659658663bf357bfbf'
AND (
token = 'Lkl4eYXvXFlVJaMOqlib3wWFf3LooXHGezczBiAubJw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)