UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TDsStP66NsBo39iCMOuYAmqQJRAN58Pb/AVh3v3YGm8='
WHERE
key_id = '0ee2970dbd6bd60e270235fef1dc9e4d2f39cdb244a38f8e16c4ee9f839015e0'
AND (
token = 'TDsStP66NsBo39iCMOuYAmqQJRAN58Pb/AVh3v3YGm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)