UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rtCA6D90IHs9luUWET+04+VfwYVgk8SQDkfrt+kqJl8='
WHERE
key_id = 'dd3b09ecd4c43b3416d6bbbb0e602593ced99e5be883634e37cebae5ad878e75'
AND (
token = 'rtCA6D90IHs9luUWET+04+VfwYVgk8SQDkfrt+kqJl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)