UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pn+vXtfjJt9nTDq36gO2uql6wpUpqRrAjbigzeqhDVk='
WHERE
key_id = 'e587b8e3869c1b35659ad6ac6139c1375f7c310a504982776e86e396d8e45174'
AND (
token = 'Pn+vXtfjJt9nTDq36gO2uql6wpUpqRrAjbigzeqhDVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)