UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AAPb9YfrWsf0xB53fIP+CKs7g5tZDKCTNoA6Y2Tugr0='
WHERE
key_id = '80902adffffe10e5717b36f181cd3ab81c8193a273fa5202b98e3688b2b2b1d3'
AND (
token = 'AAPb9YfrWsf0xB53fIP+CKs7g5tZDKCTNoA6Y2Tugr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)