UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o3BoPkBQieeP+8Wo2UENWb2+DKEO74n8pmYL71oE+DQ='
WHERE
key_id = 'd86502f0a7fc0608c967f6ab59a6ebb9fa5ce99433cbc904d881a89651937dfe'
AND (
token = 'o3BoPkBQieeP+8Wo2UENWb2+DKEO74n8pmYL71oE+DQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)