UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M1wWZGrjUqpMA8pE5JNmq4Po88eo/qnLfcfJwcGErrk='
WHERE
key_id = 'fc4d92342fe314330d0b334349e8ddacf736547cdb1a764098f3d0793fd18534'
AND (
token = 'M1wWZGrjUqpMA8pE5JNmq4Po88eo/qnLfcfJwcGErrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)