UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fdza7rmuQzmYeA3ywBa5uPjD61bqO8Az6gppBMSkPpc='
WHERE
key_id = '44f4acbd965fd3f9bbe3f40e390dd55b12b7997a8108845627a6db2371ef4532'
AND (
token = 'fdza7rmuQzmYeA3ywBa5uPjD61bqO8Az6gppBMSkPpc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)