UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EM+ro7Mwe0+CIGTyPBDqPE4srK7tf8kxglDoE5ax4kg='
WHERE
key_id = '3e7b5e61eca4771b70568966b22a0903607b7dd9f6951abcae6e0f6193da64fd'
AND (
token = 'EM+ro7Mwe0+CIGTyPBDqPE4srK7tf8kxglDoE5ax4kg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)