UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WwXrL2IMlg1cIPSj/nhY7djqT8dmMsgrgUC1pnV/1cs='
WHERE
key_id = '7f1d31b75e8539b4948e81ffc937216121b4985bae6f3991d93c290542c180df'
AND (
token = 'WwXrL2IMlg1cIPSj/nhY7djqT8dmMsgrgUC1pnV/1cs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)