UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+PhNm2gSCeDrKRn8ktZ8xjS21mSPOD5dBnav2tD5uBQ='
WHERE
key_id = 'a120d791d5bd4d23f6b788ef42df5aa93464f2b38c336c1cfbf5695a928a2382'
AND (
token = '+PhNm2gSCeDrKRn8ktZ8xjS21mSPOD5dBnav2tD5uBQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)