UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eMCI8gycVFnAPbn5M7cyDPbUc+O5LPpnuS/6tlY0asc='
WHERE
key_id = '8d843222363233b3b01bec04b2a95d4529ee36b06b0a606cdaeac217f3f68470'
AND (
token = 'eMCI8gycVFnAPbn5M7cyDPbUc+O5LPpnuS/6tlY0asc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)