UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z4LZA7rBYJpKE7UoKmmS70/lymNHwUa6Fs5G985BDTs='
WHERE
key_id = 'faec9ec59e529c67aab162a5979df60bf26123dc13cfd635168371cca5b35e0e'
AND (
token = 'Z4LZA7rBYJpKE7UoKmmS70/lymNHwUa6Fs5G985BDTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)