UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ijye4gCzXx70mSNiW01wdEEN8Yai16n8Ob0dpW4y/AI='
WHERE
key_id = '540c1e6f32cdd31db5a525559ad2933ac60aeebc26484808c8bdc7d433ddc033'
AND (
token = 'ijye4gCzXx70mSNiW01wdEEN8Yai16n8Ob0dpW4y/AI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)